"""
示例数据生成器
为学生信息管理系统添加示例数据
"""

from student import Student
from service import StudentService


def add_sample_data():
    """添加示例学生数据"""
    service = StudentService()

    # 示例学生数据
    sample_students = [
        Student("2025001", "张三", 20, "男", "计算机应用技术", "计算机1班", "13802025001", "zhangsan@example.com"),
        Student("2025002", "李四", 19, "女", "计算机应用技术", "计算机1班", "13802025002", "lisi@example.com"),
        Student("2025003", "王五", 21, "男", "软件技术", "软件1班", "13802025003", "wangwu@example.com"),
        Student("2025004", "赵六", 20, "女", "软件技术", "软件1班", "13802025004", "zhaoliu@example.com"),
        Student("2025005", "钱七", 22, "男", "网络技术", "网络1班", "13802025005", "qianqi@example.com"),
        Student("2025006", "孙八", 19, "女", "网络技术", "网络1班", "13802025006", "sunba@example.com"),
        Student("2025007", "周九", 20, "男", "数据库技术", "数据库1班", "13802025007", "zhoujiu@example.com"),
        Student("2025008", "吴十", 21, "女", "数据库技术", "数据库1班", "13802025008", "wushi@example.com"),
    ]

    print("正在添加示例数据...")
    success_count = 0

    for student in sample_students:
        success, messages = service.add_student(student)
        if success:
            success_count += 1
            print(f"✓ 添加学生 {student.name} (学号: {student.student_id}) 成功")
        else:
            print(f"✗ 添加学生 {student.name} 失败: {messages[0] if messages else '未知错误'}")

    print(f"\n示例数据添加完成！成功添加 {success_count}/{len(sample_students)} 个学生")

    # 显示统计信息
    stats = service.get_statistics()
    if stats:
        print(f"\n当前系统统计:")
        print(f"总学生数: {stats['total_count']}")
        print(f"性别分布: {stats['gender_stats']}")
        print(f"专业分布: {stats['major_stats']}")


if __name__ == "__main__":
    add_sample_data()
